package com.shg.web.ztest;

import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.shg.bean.Book;
import com.shg.bean.QueryResult;
import com.shg.service.search.BookSearchService;

public class BookSearchServiceTest {

	static BookSearchService bookSearchService;
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		ApplicationContext context=new ClassPathXmlApplicationContext("application-web-context.xml");
		bookSearchService = (BookSearchService)context.getBean("bookSearchServiceBean");
	}

	@Test
	public void testGetSearch() {
		QueryResult<Book> result = bookSearchService.getSearch(1,"我喜欢", 0, 5);
		for(Book book:result.getResultList()){
			System.out.println(book.getBookName());
			System.out.println(book.getDescription());
		}
	}

}
